Namespace("sketch.ui.iphone");

(function(fwk, ui) {
    ui.iphone.PinPoint = klass(fwk.UIElement, (function() {
        return {
            _constructor:function() {
                this.width(36);
                this.height(46);
                this.properties.createProperty('color', 'Pin color', 'red');

                this._reflection = fwk.Resources['pin_reflection'];
                this._leg = fwk.Resources['pin_leg'];
            },
            color:function(value){
                return this.properties.color(value);
            },
            resizeDimensions:function(){
                return fwk.ResizeDimension.None;
            },
            drawSelf:function(context){
                var x = this.left(),
                    y = this.top(),
                    w = this.width(),
                    h = this.height();

                context.drawImage(this._leg, x+6, y+10);
                context.circle(x+8, y+8, 8);
                context.fillStyle = this.color();
                var color = new fwk.Color(this.color());
                color.setV(color.getV() * 0.8);
                context.strokeStyle = color.toRGBA();
                context.fill();
                context.stroke();
                context.drawImage(this._reflection, x, y);
            }
        };
    })());
})(sketch.framework, sketch.ui);